1. Field of the Invention
This invention pertains in general to computer animation and in particular to a way to smooth transitions between animation sequences.
2. Background of the Invention
A xe2x80x9ccharacterxe2x80x9d in computer animation is any distinct animated object. For example, a character can be a baseball player, a ball being caught by the baseball player, a base on the field being moved as a player slides into it, or an electronic scoreboard on the outfield wall. In a computer animation system, a character is typically represented by a skeleton. A skeleton typically consists of a bone for each moving part of the skeleton. FIG. 1 is an example of a skeleton 100 for a humanoid character. The skeleton 100 has a root bone 102 that is at the top of a logical hierarchy of other bones. For example, the root bone 102 is coupled to a spine bone 104. The spine bone 104, in turn, is coupled to another spine bone 106. Further down the hierarchy are left 108, center 110, and right 112 shoulder bones, a head bone 114, and left 116 and right 118 hand bones. In the other direction from the root bone 102 are left 120 and right 122 knee bones. The connections between the bones are referred to as joints. For example, a joint 124 connects the root bone 102 to spine bone 104.
Each bone is defined in terms of a translation, a rotation, and a parent. The parent is the bone immediately above the given bone in the skeleton hierarchy. The translation and rotation are the distance and direction of the given bone, respectively, from its parent. According to this definition, moving the parent bone causes each child bone to move as well. The root bone 102 is the ultimate parent of the skeleton 100 and, accordingly, the entire skeleton can be translated or rotated by translating or rotating the root bone. Likewise, a sub-hierarchy of the skeleton 100, such as an arm or a leg, can be translated or rotated by translating or rotating the bone at the top of the sub-hierarchy.
The skeleton 100 is animated by applying animation data, including sets of rotations and/or translations, to one or more of the bones. The bones are translated and/or rotated in response to the animation data and other software or hardware maps the 3-dimensional animation into 2-dimensional pixels for display on a display device.
The animation data are usually generated using one of two techniques: motion capture or by hand. In motion capture, sensors are attached to an actor""s body and readings are collected while the actor performs the movement to be animated. For example, an actor for a baseball game might catch a ball, throw a ball, slide into a base, etc. The readings from the sensors are then converted into animation data that can be applied to the skeleton. Alternatively, an animator can specify the animation data by manually entering sets of translations and rotations. Interpolation can be performed to generate animation data between the hand-specified data, if necessary.
The animations for a character are typically grouped into different actions. For example, an outfielder character in a baseball game can have separate animations for idling, walking, running, catching a ball, and throwing a ball. When a character changes an animation, such as when the outfielder changes from idling to walking, or from walking to running, noticeable xe2x80x9cjumpingxe2x80x9d or xe2x80x9cpoppingxe2x80x9d artifacts may occur when the first animation is replaced by the second animation. These artifacts occur because the skeleton orientation at the end of the first animation does not necessarily align with the skeleton orientation at the beginning of the second animation. As a result, the character appears to abruptly switch from one action to the other when the animations change.
One prior art technique for smoothing transitions between animations is to provide a uniform hero pose. The xe2x80x9chero posexe2x80x9d is a predetermined character position at the start and end of every animation. In order to smooth the transitions, the first animation is run until the character reaches the hero pose, at which point the second animation, which starts with the hero pose, is run. This technique is effective, but it severely limits the numbers, types, and sequences of animations that can be applied to a character due to the need to start from the hero pose. In addition, the animations can get very complex if there are multiple hero poses and animations.
Another problem with current skeleton animation systems is that long-duration animations often look strange or fake. This problem occurs because the long-duration animations, such as idling, walking, or running, are created by looping a short-duration animation. For example, an animation of a running character may actually contain only a few keyframes that are repeatedly looped for as long as the character performs the animation. The human brain is very proficient at pattern recognition and, therefore, the repeating animations are easily identified by the viewer and often appear unnatural.
Accordingly, there is a need for a way to provide smooth transitions between different character animations that does not suffer the performance drawbacks of using a hero pose. Preferably, a solution to this need will also provide a way to make looped and other long-duration animations appear more realistic.
The above needs are met by an animation system, method, and computer program product that uses directed acyclic graphs (DAGs) to control the animation. A DAG is a directed graph of coupled nodes and edges where no path along the edges starts and ends at the same node. The present invention associates a DAG with each bone of the skeleton that is being animated. Each DAG specifies an animation to perform on the bone. Certain node types can smooth transitions and make looped animations appear more realistic. Because the actual type of node is abstracted from the bone, i.e., the bone neither xe2x80x9cseesxe2x80x9d nor xe2x80x9ccaresxe2x80x9d how the animation data applied to the bone are generated, new animations can be performed by merely adding new nodes or node types to the DAG. Thus, additional animations and animation effects can be utilized without changing the core animation technique.
The bones of the skeleton are animated in hierarchical order. When a bone is animated, the bone polls its associated DAG. As part of the poll, the bone provides the time elapsed since the last poll. Alternative embodiments of the present invention may use different techniques for providing the current time or time elapsed since the last poll to the DAG. In response, the DAG outputs animation data for animating the bone. Thus, each bone in the skeleton is animated according to the animations defined by its associated DAG, if any.
The DAG for a bone typically includes a plurality of nodes arranged in a hierarchical structure. As the character is animated, nodes are dynamically added and deleted from the DAG responsive to the animation needs for the character. In one embodiment, each node has one output and zero, one, or two inputs, although other embodiments can have nodes with more inputs and/or outputs. In one embodiment, there are two types of nodes: data generation nodes (DG nodes) and combiner nodes. DG nodes have either zero or one input. DG nodes having zero inputs include: fixed, animate, track, reverse, mirror, and noise nodes. A fixed node outputs animation data specifying a fixed rotation. An animate node outputs pre-generated animation data held in the node, such as animation data generated from motion capture or hand-keyframing. A track node outputs animation data for causing the bone to track a point in the animation""s world space. A reverse node is like an animate node, except that a reverse node runs the animation backwards through time. A mirror node is also like an animate node, except that a mirror node mirrors the animation data across a symmetric body. A noise node outputs noise, including random, Brownian, and sinusoidal noise. A noise node can be used to make a looped animation appear more realistic by adding varying noise to the loop.
A DG node having one input outputs a modified version of the animation data received at the input. In one embodiment of the present invention, DG nodes having one input include a limit node that limits the range or rate of rotation in the input data and a reflect node that reflects input data across a symmetric axis at the bone level.
Combiner nodes preferably have two inputs. In general, combiner nodes receive animation data on the two inputs and output animation data combining the animations received as input. Combiner nodes include: blend, overlay, and transition nodes. A blend node combines the two input animations at a certain ratio, an overlay node overlays one animation over another at a certain rate, and a transition node transitions from a first animation to a second at a certain rate.
When a DAG is polled, the top node recursively polls the lower nodes of the DAG until one or more DG nodes having zero inputs are reached. The animation data output from these nodes is fed back up the hierarchy as inputs to higher level nodes and modified by the various nodes until the data becomes an input to the top node. This data from the top node is output to, and animates, the bone.